<?php

namespace App\Http\Controllers\desktop\cs;

use App\Http\Controllers\Controller;
use App\Models\Category;
use Illuminate\Support\Facades\Request;
use Closure;
use Illuminate\Support\Facades\Auth;

class BaseController extends Controller {
	
	public function __construct(Request $request) {
		$this->middleware(function($request,Closure $next){
			$categories = Category::select(['id', 'name', 'order'])->get();
			$member = Auth::user();
			
			view()->share('categories', $categories);
			view()->share('member', $member);
			
			return $next($request);
		});
	}
	
	public function getMember() {
		$member = auth()->user();
		return $member;
	}
	
}
